<template>
  <div class="slider" ref="slider">
    <div class="slider_group" ref="sliderGroup">
      <slot></slot>
    </div>
    <div class="slider_dot" ref="sliderDot"></div>
  </div>
</template>

<style scoped lang='less'>
  .slider {
    .slider_group {
    
    }
    .slider_dot {
    
    }
  }
</style>

<script>
  import BSroll from "better-scroll";
  
  
  // 轮播图组件的封装，可以配参数控制各种功能,参数是父组件传递
  export default {
    data () {
      return {}
    },
    props:{
      loop:{
        type:Boolean,  //循环轮播
        default:true
      },
      autoPlay:{
        type:Boolean,
        default:true
      }
    },
    mounted(){
      setTimeout(()=>{
      this.setSliderWidth();
      },20)
    },
    methods:{
      setSliderWidth(){
        this.children = this.$refs.sliderGroup.children;
      }
    },
    components:{
      BSroll
    }
    
  }
</script>
